//package com.apimarket.service;
//
//import com.apimarket.dao.SysRoleMapper;
//import com.apimarket.entity.SysRole;
//import com.apimarket.entity.vo.PageObject;
//
//import javax.xml.rpc.ServiceException;
//import java.util.List;
//
//public class SysRoleServiceImpl {
//    private SysRoleMapper sysRoleMapper;
//
//    public PageObject<Object> findPageObject(String name, Integer pageCurrent) throws ServiceException {
//        //1.对参数进行校验
//        if(pageCurrent==null||pageCurrent<1)
//            throw new IllegalArgumentException("当前页码值无效");
//        //2.查询总记录数并进行校验
//        int rowCount=sysRoleMapper.getRowCount(name);
//        if(rowCount==0)
//            throw new ServiceException("没有找到对应记录");
//        //3.查询当前页记录
//        int pageSize=2;
//        int startIndex=(pageCurrent-1)*pageSize;
//        List<SysRole> records=
//                sysRoleMapper.findPageObjects(name,
//                        startIndex, pageSize);
//        //4.对查询结果进行封装并返回
//        return new PageObject<>(pageCurrent, pageSize,
//                rowCount, records);
//    }
//}
